//
//  NSObject_zframework.h
//  advideo
//
//  Created by mokai on 14-7-25.
//  Copyright (c) 2014年 cloudyoo. All rights reserved.
//

#ifndef zframework_Define
#define zframework_Define

/***
 ==============
 文件导入
 ==============
 ***/
//thirdparty
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#import <MBProgressHUD/MBProgressHUD.h>
#import <SIAlertView/SIAlertView.h>
#import <FMDB/FMDB.h>
#import <pop/POP.h>
//config

//utils
#import "DB.h"
#import "DateUtils.h"
#import "AlertUtils.h"
#import "UIUtils.h"

//system class extra
#import "NSDate+zframework.h"
//ui extra
#import "UIView+zframework.h"
#import "UIViewController+zframework.h"

//Z utils
#import "F.h"
#import "M.h"



/***
 ==============
 系统配置
 ==============
 ***/
#define     IOS_VERSION         [[[UIDevice currentDevice] systemVersion] floatValue]
#define     IPhone5             ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define     IPhone4             ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#define     SCREEN_W            [UIScreen mainScreen].bounds.size.width//屏幕宽度
#define     SCREEN_HEIGHT       [UIScreen mainScreen].bounds.size.height//屏幕高度
#define     SCREEN_H            (7.0 > IOS_VERSION ? (SCREEN_HEIGHT-20): SCREEN_HEIGHT)//兼容ios6,7的屏幕高度
#define     K_NAVIGATION_Y      (7.0 > IOS_VERSION ? 0.0:20.0 )//内容VIew的y
#define     View_Space          10.f
#define     Top_Status_H        20.f
#define     Top_NavBar_H        44.f
#define     K_VC_Y              (7.0 > IOS_VERSION ? 44.0:64.0)
#define     VIEW_RECT           CGRectMake(0, K_VC_Y, SCREEN_W, SCREEN_H-K_VC_Y)//内容ViewRect
#define     Nav_Item_W          64.f

#define     TabBar_Bt_W         ([UIScreen mainScreen].bounds.size.width/4.0)
#define     TabBar_H            49.0f
#define     K_NAVIGATION_Y_FIX  (7.0 > IOS_VERSION ? -20.0:00.0 )// 修正IOS7 与IOS7 以下的错误

/***
 ==============
 宏定义
 ==============
 ***/
#ifndef DEBUG
#define DEBUG YES
#endif
//日志
#ifdef DEBUG
#define NSLog(...) NSLog(__VA_ARGS__)
#define debugLog(...) NSLog(__VA_ARGS__)
#define debugMethod() NSLog(@"%s", __func__)
#else
#define debugLog(...)
#define debugMethod()
#define NSLog(...){}  
#endif

//控件对齐
#define TEXT_ALIGNMENT_CENTER (IOS_VERSION<6.0 ?UITextAlignmentCenter:NSTextAlignmentCenter )
#define TEXT_ALIGNMENT_LEFT (IOS_VERSION<6.0 ?UITextAlignmentLeft:NSTextAlignmentLeft )
#define TEXT_ALIGNMENT_RIGHT (IOS_VERSION<6.0 ?UITextAlignmentRight:NSTextAlignmentRight )

//通用的宏定义
#define     color(R, G, B, A)       [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]
#define     rgb_color(r,g,b,a)      [UIColor colorWithRed:(r) / 255.0 green:(g) / 255.0 blue:(b) / 255.0 alpha:a]
#define     sa_color(s,a)            [UIColor colorWithRed:(s) / 255.0 green:(s) / 255.0 blue:(s) / 255.0 alpha:a]

//字体
#define     kFont(size)         [UIFont systemFontOfSize:size]
#define     kFontBold(size)     [UIFont boldSystemFontOfSize:size]

//字符处理
#define     str_isblank(str)    (str==[NSNull null] || str==nil || ((((NSString *)str).class==NSString.class || ((NSString *)str).class==NSMutableString.class) && ((NSString *)str).length==0))//是否为nil或空字符
#define     str_isnotblank(str)    (!str_isblank(str))
#define     str_blank(str)   (str_isblank(str)?@"":str_trim(str))//如果为nil则返回空字符
#define     str_default(str,val)   (str_isblank(str)?val:str)//如果为nil则返回空字符
#define     str_trim(str)    [str stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]//去掉两边空格


#endif